package com.job.netease;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 * @ClassName: test.Netease4
 * @Description:
 * @Author: 12071
 * @Date: 2022/4/16 15:24
 */
public class Netease4 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer str = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(str.nextToken());
        str = new StringTokenizer(in.readLine());
        int[] vals = new int[n];
        for (int i = 0; i < n; i++) {
            vals[i] = Integer.parseInt(str.nextToken());
        }
        long res =0;

        for (int i = 0; i < n; i++) {
            long tmp = 1;
            for (int j = i; j < n; j++) {
                tmp*=vals[j];
                long tmp2 = tmp;
                int cnt = 0;
                while (tmp2%10==0){
                    cnt++;
                    tmp2/=10;
                }
                res+=cnt;
            }
        }
        System.out.println(res);
    }
}


/**
 * public class Main {
 *     public static void main(String[] args) throws IOException {
 *         Scanner sc = new Scanner(System.in);
 *         BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
 *         StringTokenizer str = new StringTokenizer(in.readLine());
 *         int n = Integer.parseInt(str.nextToken());
 *         str = new StringTokenizer(in.readLine());
 *         int[] vals = new int[n];
 *         for (int i = 0; i < n; i++) {
 *             vals[i] = Integer.parseInt(str.nextToken());
 *         }
 *         long res =0;
 *
 *         long [][] dp = new long[n+1][10];
 *         long [][] cnt = new long[n+1][10];
 *         for(int i = 0; i < n; i++){
 *             int zeros = 0;
 *             while(vals[i] % 10 == 0){
 *                 zeros ++;
 *                 vals[i] /= 10;
 *             }
 *             for(int j = 1; j < 10; j++){
 *                 long x = (long)vals[i] * j;
 *                 int zs = 0;
 *                 while(x % 10 == 0){
 *                     zs ++;
 *                     x /= 10;
 *                 }
 *                 if(dp[i][j] != 0){
 *                     dp[i+1][(int)(x % 10)] += dp[i][j] + (zeros  + zs) * cnt[i][j];
 *                     cnt[i+1][(int)(x % 10)] += cnt[i][j];
 *                 }
 *             }
 *             dp[i+1][vals[i] % 10] += zeros;
 *             cnt[i+1][vals[i] % 10] += 1;
 *         }
 *         for(int i = 1; i <= n; i++)
 *             for(int j = 1; j < 9; j++){
 *                 res += dp[i][j];
 *             }
 *         System.out.println(res);
 *     }
 * }
 *
 *
 */
